home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / lang / Python152_Src.lha / Python152_Source / Amiga_Misc / testset / test_misc.pyc (.txt) < prev   
Python Compiled Bytecode  |  1998-11-12  |  2KB  |  62 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import os
  5. import amiga
  6. import time
  7. import Dos
  8. TestError = 'FAILED --- Amiga misc '
  9.  
  10. def testeq(res, check, info):
  11.     if res != check:
  12.         raise TestError + info
  13.     
  14.  
  15.  
  16. def testcrc32(str, check):
  17.     testeq(amiga.crc32(str), check, 'amiga.crc32')
  18.  
  19. print 'TEST amiga.crc32'
  20. testcrc32('', -1)
  21. testcrc32('a', 390611388)
  22. testcrc32('abc', -891568579)
  23. testcrc32('abcdefghijklmnopqrstuvwxyz', -1277644990)
  24. testcrc32('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 1409845213)
  25. testcrc32('12345678901234567890123456789012345678901234567890123456789012345678901234567890  The quick brown Fox jumps over the lazy Dog', 58971606)
  26. print 'amiga.crc32 TEST OK'
  27. print 'TEST Dos.touch, filedates, Amiga dates/times'
  28.  
  29. try:
  30.     os.remove('t:touchtest')
  31. except os.error:
  32.     pass
  33.  
  34.  
  35. try:
  36.     Dos.touch('t:touchtest')
  37. except:
  38.     raise TestError + 'Dos.touch'
  39.  
  40.  
  41. try:
  42.     datestr = ('18-Jul-98', '13:33:33')
  43.     datestamp = Dos.StrToDate(datestr[0], datestr[1])
  44.     unixtime = Dos.DS2time(datestamp)
  45.     unixtimestr = time.ctime(unixtime)
  46.     testeq(unixtime, 900765213.0, 'Dos.DS2time')
  47.     testeq(unixtimestr, 'Sat Jul 18 13:33:33 1998', 'Dos.DS2time')
  48.     Dos.touch('t:touchtest', unixtime)
  49.     ds = Dos.Examine('t:touchtest')[Dos.fib_Date]
  50.     testeq(ds, datestamp, 'Dos.touch')
  51.     datestamp = Dos.DateStamp()
  52.     datestr = Dos.DateToStr(datestamp)
  53.     unixtime = Dos.DS2time(datestamp)
  54.     unixtimestr = time.ctime(unixtime)
  55.     Dos.SetFileDate('t:touchtest', datestamp)
  56.     ds = Dos.Examine('t:touchtest')[Dos.fib_Date]
  57.     testeq(ds, datestamp, 'Dos.SetFileDate')
  58.     print 'Dos.touch/Amigadates TEST OK'
  59. except:
  60.     raise TestError + 'Dos filedates/Amiga dates'
  61.  
  62.